home *** CD-ROM | disk | FTP | other *** search
- 0 rem << cd41-8 >>
- 1 rem ==================================
- 2 rem commodares problem #37-3 :
- 3 print"[147]power product"
- 4 rem solution by
- 5 rem scott duncan
- 6 rem ==================================
- 9 t0=ti
- 10 dim p(99):for x=10 to 90 step10:p(x)=1:a=int(x/10)
- 20 for y=1 to 9:p(x+y)=p(x+(y-1))*a:next:next
- 30 for l=1 to 99:if p(l)>9999 goto 100
- 40 for m=0 to l
- 50 q=p(l)*p(m) : if q>9999 goto 100
- 60 j=l*100+m : k=m*100+l
- 70 if q=j then a=l:c=m:gosub 120
- 80 if q=k then a=m:c=l:gosub 120
- 90 next m
- 100 next l
- 110 print "total " t : print (ti-t0)/60 "seconds": end
- 120 a$=str$(a+1000) : c$=str$(c+1000) : t=t+1
- 130 print q"= "mid$(a$,4,1) "^" mid$(a$,5)" * "mid$(c$,4,1)"^"mid$(c$,5):return
-